package com.bwie.mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component
public class Customer {
    @Autowired
    private JavaMailSender javaMailSender;
    @JmsListener(destination = "bbb")
    public void take(String email){
        System.out.println("读取到的是："+email);
        SimpleMailMessage smm = new SimpleMailMessage();
        smm.setTo(email);
        smm.setFrom("2862034166@qq.com");
        smm.setSubject("通知");
        smm.setText("棒棒哒啊");
        javaMailSender.send(smm);
    }
}
